<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>定时器</title>
</head>
<body>
<script>
    for(var i=0;i<3;i++) {
        setTimeout(function (a) {
            console.log(a);
        }(i), 1000)
    }
</script>
</body>
</html>
